import { useSearchParams } from 'react-router-dom';

export function useSearch() {
    const [searchParams] = useSearchParams();

    /** 编辑时的储值卡id */
    const id = searchParams.get('id');
    
    /** 客户id */
    const customerId = searchParams.get('customerId');

    return {
        /** 储值卡id */
        id,
        
        /** 客户id */
        customerId,

        /** 是否是编辑模式 */
        isEdit: !!id,
    }
} 